Global $ans, $clip, $control, $create, $def, $inifle, $res, $type

$inifle = @ScriptDir & "\Settings.ini"
$def = IniRead($inifle, "Title", "part", "")
AutoItSetOption("WinTitleMatchMode", 2)
WinActivate($def, "")
$clip = ClipGet()
ClipPut('')
Send("^c")
Sleep(500)
$control = ClipGet()
If $control <> "" And StringInStr($control, " ") < 1 And StringLeft($control, 1) = "$" Then
	$res = IniRead($inifle, "Jump To Control Creation", "prompt", "")
	If $res <> 1 Then
		$res = MsgBox(262177, "Jump To Control Creation", _
			"Jumps to where selected control was created. OK = Jump. CANCEL = Abort. (Next is shown)", 0)
		IniWrite($inifle, "Jump To Control Creation", "prompt", $res)
	EndIf
	If $res = 1 Then
		$type = StringInStr($control, "_")
		If $type > 0 Then
			$type = StringMid($control, 2, $type - 2)
			$create = $control & ' = GuiCtrlCreate' & $type & "("
			Send("^f")
			Sleep(500)
			Send($create)
			Sleep(500)
			Send("!f")
			While 1
				$ans = MsgBox(262177, "Jump To Next (if any).", "OK = Try again.")
				If $ans = 1 Then
					Send("{F3}")
				Else
					Send("^{END}")
					Send("+{F2}")
					ExitLoop
				EndIf
			WEnd
		EndIf
	EndIf
Else
	$res = 4
	IniWrite($inifle, "Jump To Control Creation", "prompt", $res)
EndIf
ClipPut($clip)

Exit

-------------------------------------------------

Global $ans, $clip, $def, $found, $inifle, $res, $variable

$inifle = @ScriptDir & "\Settings.ini"
$def = IniRead($inifle, "Title", "part", "")
AutoItSetOption("WinTitleMatchMode", 2)
WinActivate($def, "")
$clip = ClipGet()
ClipPut('')
Send("^c")
Sleep(500)
$variable = ClipGet()
If $variable <> "" And StringInStr($variable, " ") < 1 And StringLeft($variable, 1) = "$" Then
	$res = IniRead($inifle, "Jump To Variable Declaration", "prompt", "")
	If $res <> 1 Then
		$res = MsgBox(262177, "Jump To Variable Declaration", _
			"Jumps to where selected variable was declared. OK = Jump. CANCEL = Abort. (Next is shown)", 0)
		IniWrite($inifle, "Jump To Variable Declaration", "prompt", $res)
	EndIf
	If $res = 1 Then
		Send("^f")
		Sleep(500)
		Send($variable)
		Sleep(500)
		Send("!f")
		While 1
			Sleep(250)
			Send("^+{RIGHT}")
			Sleep(250)
			Send("^c")
			Sleep(250)
			$found = ClipGet()
			$found = StringReplace($found, ",", "")
			$found = StringStripWS($found, 8)
			If $found = $variable Then
				Send("^+{LEFT}")
				Send("{HOME}")
				Send("+{END}")
				Send("^c")
				Sleep(500)
				$found = ClipGet()
				If StringInStr($found, "Global ") > 0 Or StringInStr($found, "Local ") > 0 Then
					$ans = MsgBox(262177, "Jump To Next (if any)", "OK = Try again.")
					If $ans = 1 Then
						Send("{F3}")
					Else
						Send("{HOME}")
						Send("{F3}")
						Sleep(250)
						Send("+{RIGHT 2}")
						Sleep(250)
						Send("^c")
						Sleep(250)
						$found = ClipGet()
						If StringRight($found, 2) <> ", " Then Send("+{LEFT 2}")
						ExitLoop
					EndIf
				Else
					Send("{F3}")
				EndIf
			Else
				If StringInStr($found, $variable) > 0 Then
					Send("{F3}")
				Else
					$ans = MsgBox(262177, "Not Found", "OK = Try again.")
					If $ans = 1 Then
						Send("{F3}")
					Else
						ExitLoop
					EndIf
				EndIf
			EndIf
		WEnd
	EndIf
Else
	$res = 4
	IniWrite($inifle, "Jump To Variable Declaration", "prompt", $res)
EndIf
ClipPut($clip)

Exit
